import React, { Component } from 'react'

class NavTab extends Component {

  toggleTabNav = currentIndex => this.props.setNavTabCurrentIndex(currentIndex)

  render() {
    let { currentIndex } = this.props
    return (
      <div className="category-tab-nav">
        <ul>
          <li class={currentIndex === 0 ? 'active' : ''} onClick={() => this.toggleTabNav(0)}>
            分类
          </li>
          <li class={currentIndex === 1 ? 'active' : ''} onClick={() => this.toggleTabNav(1)}>
            食材
          </li>
          <li class={currentIndex === 0 ? 'slider' : 'slider right'}></li>
        </ul>
      </div>
    )
  }
}

export default NavTab
